package main

import (
	"fmt"
	"net/rpc"
)
type Carams struct {
	Width,Height float32
}

func main(){
	//调用DialHTTP方法创建链接
	client,err := rpc.DialHTTP("tcp","127.0.0.1:8081")
	if err!=nil {
		panic(err)
	}
	//Call同步调用远程服务器方法
	params := Carams{}
	params.Width = 2.1
	params.Height = 3
	var area *float32
	err = client.Call("MathUtil.QuadrilateralArea",params,&area)
	if err!=nil {
		fmt.Println("远程服务调用失败")
		panic(err)
	}
	fmt.Println("四边形面积为:",*area)
}
